from db.mysql_db import pool


class RoleDao:
    # 查询角色列表
    def query_role_list(self):
        try:
            con = pool.get_connection()
            cursor = con.cursor()

            sql = "select id, role from t_role"
            cursor.execute(sql)
            role_list = cursor.fetchall()

            return role_list
        except Exception as e:
            print(e)
        finally:
            if "con" in dir():
                con.close()